package com.bjb.vr.common.mapper;

import com.bjb.vr.common.ao.ResDeviceContentAo;
import com.bjb.vr.common.ao.ResGroupAo;
import com.bjb.vr.common.dto.ResDevice;
import com.bjb.vr.common.dto.ResGroup;
import com.bjb.vr.common.vo.ResGroupDevice;
import com.bjb.vr.common.vo.ResGroupVo;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author admin
 * @description 针对表【res_group(房间表)】的数据库操作Mapper
 * @createDate 2022-03-22 10:49:59
 * @Entity com.bjb.vr.common.dto.ResGroup
 */
public interface ResGroupMapper extends MPJBaseMapper<ResGroup> {

    /**
     * 获取管理员所在房间
     *
     * @param acctName
     * @return
     */
    ResGroup getAdminResGroup(String acctName);

    /**
     * 获取客户端所在房间
     *
     * @param deviceId
     * @return
     */
    ResGroup getClientResGroup(String deviceId);

    /**
     * 获取每组设备的总数
     *
     * @return
     */
    Object queryGroupNumbers(Long groupId);


    /**
     * 获取分组的个数以及名字
     *
     * @return
     */
    List<ResGroup> queryGroupInfo();

    /**
     * 获取每组的设备信息
     *
     * @param groupId
     * @return
     */
    List<ResDevice> queryOneGroupNumbers(Long groupId);


    /**
     * 获取设备所属组课程状态
     *
     * @param udid
     * @return
     */
    ResGroup getGroupClassStateByUdid(String udid);

    List<ResDevice> queryGroupDeviceByGroIdAndOn(@Param("groupId") Long groupId, @Param("onlineState") Integer onlineState);

    Object queryDeviceModeByMode(@Param("groupId") Long groupId, @Param("mode") Integer mode);

    Object queryGroupDeviceByGroIdAndOnNums(@Param("groupId") Long groupId, @Param("onlineState") Integer onlineState);

    int updateGroup(ResGroup resGroup);

    int editDeviceOfGroup(@Param("groupId") Integer groupId, @Param("devId") Integer devId);

    List<ResGroupAo> selectGroupList(@Param("groupName") String groupName, @Param("current") Long current, @Param("size") Long size);

    long selectGroupListTotal(@Param("groupName") String groupName);

    List<ResGroupDevice> queryGroupDevicesByGroupIds(@Param("groupIds") long[] groupIds);

    List<ResGroupVo> queryGroupByIds(@Param("groupIds") long[] groupIds);

    List<ResDeviceContentAo> selectContentByDeviceId(@Param("devId") Long devId);

    int deleteContentByDeviceId(@Param("udid") String udid, @Param("ids") String[] ids);

    Object queryAllNumbersByGroupContentId(@Param("groupId") Long groupId, @Param("id") Long id, @Param("installState") Integer installState);

    List<ResDevice> groupDevicesAll(@Param("groupId") Long groupId, @Param("id") Long id);

    ResGroupAo getGroupById(Integer id);
}




